/**
 * 
 */
package ar.edu.unq.svnpermission.panels;

import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.Model;

import ar.edu.unq.svnpermission.components.AutoAttacheablePanel;
import ar.edu.unq.svnpermission.domain.Group;
import ar.edu.unq.svnpermission.domain.User;
import ar.edu.unq.svnpermission.ui.model.Groups;
import ar.edu.unq.svnpermission.ui.model.Members;
import ar.edu.unq.svnpermission.ui.pages.UsersPage;

/**
 * @author nicolas
 *
 */
public class UserDetailPanel extends AutoAttacheablePanel {
	private static final long serialVersionUID = 1L;
	private User user;
	
	
	public UserDetailPanel(String id, MarkupContainer container, User user) {
		super(id, container);
		user = user;
		this.addGroupsList();
		
	}


	

	/* (non-Javadoc)
	 * @see ar.edu.unq.svnpermission.components.AutoAttacheablePanel#build()
	 */
	@Override
	public void build() {
		
	}
	
	private void addGroupsList()
	{
		@SuppressWarnings({ "unchecked", "rawtypes" })
		ListView<Group> groupsList = new ListView<Group>("groupsList", new Groups().getAll(((Members)(((UsersPage)this.getParent()).getForm()).getDefaultModelObject()).getSelectedUser())) {

			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(final ListItem<Group> item) {
				item.add(new Label("keyName",item.getModelObject().getKeyName()));				
			}

		};
		this.add(groupsList);
	}

}
